<template>
	<view class="w100 h100">
		<view class="w100 h100">
			<view class="card c3 mb10 cshow" v-for="(form,index) in orderList" :key="index" @click="toDtail(form)">
				<view class="bd1 dfa pb10">
					<view class="f-c-s f-1">
						<view class="c0 dfa">
							<text class="f16 wei6 f-1">金额:￥{{form.money}}</text>
						</view>
						<view class="f10 c6 mt5">储值时间:{{form.created_at}}</view>
					</view>
					<view class="f-c-e wei6">
						<view>
							<view class="c0 mt5" v-if="form.user && form.user.mobile">尾号{{form.user.mobile.substr(form.user.mobile.length-4)}}</view>
						</view>
						<text class="f10 p5 c9 bf8 mt5">{{form.orderIndex.payTypeFormat}}</text>
					</view>
				</view>
				<view class="mt10 f-bt bd1 pb10" v-if="form.user">
					<view class="dfa f-g-1">
						<view class="f-e-c">
							<text class="c3">{{form.user.nickname}}</text>
							<text class="f10 c9 mt5">{{form.user.mobile}}</text>
							<view class="dfbc" v-if="form.payNum">
								<text class="f10 p5 c9 bf8 mt5 bs4" v-if="form.payNum==1">门店新客</text>
								<text class="f10 p5 c9 bf8 mt5 bs4" v-else>第{{form.payNum}}次下单</text>
							</view>
						</view>
					</view>
					<view class="f-g-0 mr10" @click.stop="tocenter(form.user.mobile)">
						<u-icon name="phone-fill" color="#000" size="30"></u-icon>
					</view>
				</view>
				<view v-if="form.data" class="mt10 f-s bf8 p10 bs6 mb10 f12" style="background: #F6F6F6;">
					<view>
						<view class="mb5 c6">充值金额 <text class="ml10 c0 wei">{{form.money}}</text></view>
						<view class="mb5 c6">获赠金额 <text class="ml10 c0 wei">{{form.data.balanceGive}}</text></view>
						<view class="mb5 c6">到账金额 <text class="ml10 c0 wei">{{Number(form.data.balanceGive) + Number(form.money)}}</text></view>
						<view class="mb5 c6">获赠积分<text class="ml10 c0 wei">{{form.data.integralGive}}</text></view>
						<view class="mb5 c6">提升等级至<text class="ml10 c0 wei">{{form.data.levelGive}}</text></view>
						<view class="mb5 c6 flex">获赠优惠券
							<view v-if="form.data.couponGive" class="ml10 c0 wei">
								<view v-for="(v, i) in form.data.couponGive" :key="i">{{ v.name }}x{{ v.num }}</view>
							</view>
						</view>
					</view>
				</view>
				<view class="dfbc">
					<view class="f12">
						<view class="mb5">操作人：<text v-if="form.admin">{{form.admin.nickname}}</text></view>
						<view class="mb5">订单来源：{{form.sourceFormat}}</view>
						<view class="mb5">订单编号：{{form.orderSn}}</view>
					</view>
				</view>
				<view class="f-x-e mt10 pt10 bt1">
					<view class="f-g-0 w50 p-0-10" @click.stop="$emit('op','orderPrint',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" 
							text="打印" :color="subColor" shape="circle">
						</u-button>
					</view>
				</view>
			</view>
		</view>
		<!-- <view v-else class="w100 h100">
			<view class="card c3 mb10" v-for="(form,index) in orderList" :key="index" @click="toDtail(form)">
				<view class="bd1 dfa pb10">
					<view class="f-c-s f-1">
						<view class="c0 dfa">
							<text class="f22 wei6 f-1">储值金额：{{form.money}}</text>
						</view>
						<view class="f12 c6 mt5">时间 | {{form.created_at}}</view>
					</view>
					<view class="f-c-e wei6">
						<view>
							<text class="pr5 c0">{{form.stateFormat}}</text> | <text class="pl5"
								:style="{color:subColor}">储值订单</text>
						</view>
						<text class="f10 p5 c9 bf8 mt5">{{form.orderIndex.payTypeFormat}}</text>
					</view>
				</view>
				<view class="dfa mt10 mb5">
					<u-avatar :src="form.user.avatar" shape="square"></u-avatar>
					<view class="f-e-c ml10">
						<text class="c3">{{form.user.nickname}}</text>
						<text class="f12 c9 mt5">{{form.user.mobile}}</text>
					</view>
				</view>
				<view v-if="form.data" class="mt10 f-s bf8 p10 bs6 mb10">
					<view class="">储值赠送：</view>
					<view>
						<view class="mb5">赠送余额{{form.data.balanceGive}}</view>
						<view class="mb5">赠送积分{{form.data.integralGive}}</view>
						<view class="mb5">提升等级至{{form.data.levelGive}}</view>
						<view v-if="form.data.couponGive" class="mb5">
							<view v-for="(v, i) in form.data.couponGive" :key="i">{{ v.name }}x{{ v.num }}</view>
						</view>
					</view>
				</view>
				<view class="p-10-0 bd1">
					<view class="dfbc mb5 w100">
						<text>储值门店</text>
						<text>{{ form.store.name}}</text>
					</view>
					<view class="dfbc mb5 w100">
						<text>到账金额（元）</text>
						<view v-if="form.data && form.data.balanceSwitch == 1">
							￥{{ Number(form.data.balanceGive) + Number(form.money) }}
						</view>
						<view v-else>{{ form.money }}</view>
					</view>
				</view>
				<view class="p-10-0 dfbc bd1">
					<text>商家备注</text>
					<view class="dfa">
						<text class="mr10">{{ form.note || '无'}}</text>
						<u-button type="primary" :plain="true" text="编辑" :color="subColor" shape="circle">
						</u-button>
					</view>
				</view>
				<view class="dfbc mt10">
					<view class="tool f12">
						<view v-if="form.score == 1" class="mb5">订单来源：微信小程序</view>
						<view class="mb5">订单号：{{form.orderSn}}</view>
					</view>
					<view class="">
						<u-button type="primary" :plain="true" text="重新打印" :color="subColor" shape="circle"  @click.stop="$emit('svPrint',form)">
						</u-button>
					</view>
				</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		props: {
			orderList: {
				type: Array,
				default () {
					return []
				}
			},
			current: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				subColor: uni.getStorageSync('subject_color'),
			}
		},
		methods: {
			tocenter(e) {
				uni.makePhoneCall({
					phoneNumber: e
				});
			},
			toDtail(v) {
				return
				uni.navigateTo({
					url: `/pages/order/detail?id=${v.id}`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
</style>